//package com.kly.user.task.service;
//
//import com.alibaba.fastjson.JSONObject;
//import com.fqgj.common.utils.CollectionUtils;
//import com.fqgj.log.factory.LogFactory;
//import com.fqgj.log.interfaces.Log;
//import com.kly.user.db.dao.UserDao;
//import com.kly.user.db.dao.UserPreHomepageDao;
//import com.kly.user.db.dao.UserWlmDao;
//import com.kly.user.db.entity.UserEntity;
//import com.kly.user.db.entity.UserPreHomepageEntity;
//import com.kly.user.db.entity.UserTaskJobEntity;
//import com.kly.user.enums.LikeEnum;
//import com.kly.user.enums.UserType;
//import com.kly.user.task.ExecuteHandler;
//import com.kly.user.task.ExecuteResult;
//import com.kly.user.task.enums.TaskStatusEnum;
//import com.kly.user.task.enums.TaskTypeEnum;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.List;
//
///**
// * 处理wlm转为陌生人逻辑
// * pass用户72小时后转为陌生人
// * wlm like用户48小时转为陌生人
// * dislike用户72小时转为陌生人
// */
//@Service("wlmHandlerImpl")
//public class WlmHandlerImpl implements ExecuteHandler {
//
//    private static Log logger = LogFactory.getLog(WlmHandlerImpl.class);
//
//    @Resource
//    UserPreHomepageDao userPreHomepageDao;
//    @Resource
//    UserWlmDao userWlmDao;
//    @Resource
//    UserDao userDao;
//
//
//    @Override
//    public TaskTypeEnum getType() {
//        return TaskTypeEnum.WLM_RESET;
//    }
//
//    @Override
//    public <T> ExecuteResult doExecute(T t) {
//        UserTaskJobEntity entity = (UserTaskJobEntity) t;
//        logger.info("====Re-back to normal job starting, job detail:{}", JSONObject.toJSONString(entity));
//
//        try {
//            final List<UserPreHomepageEntity> userPreHomepageEntities = userPreHomepageDao.queryOverEffectiveRecord();
//            if (CollectionUtils.isNotEmpty(userPreHomepageEntities)) {
//                userPreHomepageEntities.parallelStream().forEach(o -> {
//                    final UserEntity user = userDao.selectByUserCode(o.getUserCode());
//                    if (UserType.NORMAL_USER.getType() == user.getUserType()) {
//                        userWlmDao.removeOverEffectiveRecord(o.getUserCode(), o.getUserCodeWlm(), LikeEnum.PASS);
//                        userWlmDao.removeOverEffectiveRecord(o.getUserCode(), o.getUserCodeWlm(), LikeEnum.DO_NOT);
//                        userWlmDao.removeOverEffectiveRecord(o.getUserCode(), o.getUserCodeWlm(), LikeEnum.LIKE);
//                    } else if (UserType.CHATTER_MODEL.getType() == user.getUserType() || UserType.MODEL.getType() == user.getUserType()) {
//                        userWlmDao.removeOverEffectiveRecord(o.getUserCode(), o.getUserCodeWlm(), LikeEnum.LIKE);
//                    }
//                });
//            }
//        } catch (Exception e) {
//            logger.info("====Re-back to normal job starting,异常1", e);
//        }
//        try {
//            userPreHomepageDao.removeRemoveUnEffectiveRecord();
//        } catch (Exception e) {
//            logger.info("====Re-back to normal job starting,异常2", e);
//        }
//
//        final ExecuteResult result = ExecuteResult.builder().jobId(entity.getId()).resultMsg("success").resultCode(TaskStatusEnum.SUCCESS.getCode()).taskType(TaskTypeEnum.WLM_RESET.getCode()).build();
//        logger.info("====Re-back to normal job end, result:{}", JSONObject.toJSONString(result));
//        return result;
//    }
//}
